//
//  DispatchQueue+Extension.swift
//  Practice
//
//  Created by miaozhihui on 2017/2/6.
//  Copyright © 2017年 DeKuTree. All rights reserved.
//

import Foundation

extension DispatchQueue {
    private static var onceTracker = [String]()
    class func once(token:String,callBack:()->()) {
        objc_sync_enter(self)
        defer {
            objc_sync_exit(self)
        }
        if onceTracker.contains(token) {
            return
        }
        onceTracker.append(token)
        print(onceTracker.count)
        print(onceTracker)
        callBack()
    }
}
